<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.lmpop.trade.ti_teamorder.Ti_groupVoucherInfo"%>
<%@ page import="com.lmpop.frame.util.PageTools"%>
<%

		Map params = new Hashtable();
		String iStart = "0";
		int counter = 0;
		List list = null;
		int limit = 3;
		String pageString = null;
		int listsize = 0;
		Hashtable nMap = new Hashtable();
		Ti_groupVoucherInfo groupVoucherInfo = new Ti_groupVoucherInfo();
		String _voucher_code = "", _enabled = "";
			
	request.setCharacterEncoding("UTF-8");

	if (request.getParameter("voucher_code") != null
			&& !request.getParameter("voucher_code").equals("")) {
		_voucher_code = request.getParameter("voucher_code");
		params.put("voucher_code", _voucher_code);
	}
	if (request.getParameter("enabled") != null
			&& !request.getParameter("enabled").equals("")) {
		_enabled = request.getParameter("enabled");
		params.put("enabled", _enabled);
	}
		String _user_id = "";
		if (session.getAttribute("session_cust_id") != null) {
			_user_id = session.getAttribute("session_cust_id").toString();
			params.put("user_id", _user_id);
		}
	
	if (request.getParameter("iStart") != null)
		iStart = request.getParameter("iStart");

	counter = groupVoucherInfo.getCountByObj(params);
	list = groupVoucherInfo.getListByPage(params, Integer
			.parseInt(iStart), limit);

	pageString=new PageTools().getGoogleToolsBar(counter,
			"/8diantuan_member.html?classtype=voucher&voucher_code=" + _voucher_code
					+ "&enabled=" + _enabled + "&iStart=", Integer
					.parseInt(iStart), limit);
%>

		<table class="tablelist">
							<thead>
								<tr>
									<th>
										团购券号
									</th>
									<th>
										券密码
									</th>
									<th>
										购买日期
									</th>
									<th>
										当前状态
									</th>
									<th>
										操作
									</th>
								</tr>
							</thead>


	<%
		if (null != list && list.size() > 0) {
			listsize = list.size();
			for (int i = 0; i < list.size(); i++) {
				nMap = (Hashtable) list.get(i);
				String order_no = "", in_date = "", enabled = "", tip = "", info_id = "", voucher_code = "", voucher_pwd = "";
				if (nMap.get("order_no") != null)
					order_no = nMap.get("order_no").toString();
				if (nMap.get("in_date") != null) {
					in_date = nMap.get("in_date").toString();
					in_date = in_date.substring(0, 19);
				}
				if (nMap.get("enabled") != null)
					enabled = nMap.get("enabled").toString();
				if (nMap.get("info_id") != null)
					info_id = nMap.get("info_id").toString();
				if (nMap.get("tip") != null)
					tip = nMap.get("tip").toString();
				if (tip.length() > 100)
					tip = tip.substring(0, 100);
				if (nMap.get("voucher_code") != null)
					voucher_code = nMap.get("voucher_code").toString();
				if (nMap.get("voucher_pwd") != null)
					voucher_pwd = nMap.get("voucher_pwd").toString();
	%>
	<tr>
		<td >
			<%=voucher_code%>
		</td>
		<td >
			<%=voucher_pwd%>
		</td>
		<td >
			<%=in_date%>
		</td>
		<td >
			
			<%
				if (enabled.equals("0"))
							out.println("已使用");
			%>
			<%
				if (enabled.equals("1"))
							out.println("未使用");
			%>
			<%
				if (enabled.equals("2"))
							out.println("已作废");
			%>
		</td>
		<td >
			<%if (enabled.equals("1")) {%>             	
                <a href="javascript:updateTradeState('<%=voucher_code %>','<%=voucher_pwd %>','<%=order_no %>','2','a_3<%=i %>')" id="a_3<%=i %>">退券</a>
			<%}else{
				out.print("无");
			}%>
		</td>
	</tr>

	<%
		}
		}
	%>
</table>
			<div style="float:right; margin-top:10px;"><%=pageString%></div>
